package com.itheima.mydate;

import java.util.Date;

public class Date获取和设置时间方法_02 {
    /*
    long getTime();获取当前日期对象所对应的毫秒值并返回
    void setTime(lone time): 给当前日期对象重新设置毫秒值
     */
    public static void main(String[] args) {
        //创建一个当前系统时间所对应的日期对象
        Date date = new Date();
        System.out.println("date=" + date);

        long time = date.getTime();
        System.out.println("time=" + time);

        Date date1 = new Date(time);
        System.out.println("date1=" + date1);

        long time1 = time -(1000L*60*60*24*30);
        date.setTime(time1);
        System.out.println("time1=" + time1);
        System.out.println("date=" + date);

        date = new Date(time1);
        System.out.println(date);
    }
}
